<?php 
namespace Admin\Controller;
use Common\Controller\BaseController;
class CommonController extends BaseController{
	
	function _initialize() {
		parent::_initialize();
	}
	
	public function _del($m,$ids){
		if ( empty($ids) ) {
			_apiReturn(0, "请设置删除数据ID");
		}
		$map = array($m->getPk() => array('in', $ids));
		$lists = $m->where($map)->select();
		if($m->where($map)->delete()){ //删除本地数据库中的row
			_apiReturn(1, "删除成功");
		} else {
			_apiReturn(0, "删除失败");
		}
	}
	
	public function _delbyuser($m,$ids,$uid){
		if ( empty($ids) ) {
			_apiReturn(0, "请设置删除数据ID");
		}
		$map = array($m->getPk() => array('in', $ids));
		$lists = $m->where($map)->select();
		if($uid){
			foreach($lists as $vo){
				if($vo['uid'] != $uid){
					_apiReturn(0, '有您没有权限删除的数据，无法删除', $data, $url);
				}
			}
		}
		if($m->where($map)->delete()){ //删除本地数据库中的row
			_apiReturn(1, "删除成功");
		} else {
			_apiReturn(0, "删除失败");
		}
	}
}
?>